package com.mofeng.myshop.domain.vo;

import com.mofeng.myshop.domain.po.Command;
import com.mofeng.myshop.domain.vo.base.BaseVo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.Collection;
import java.util.List;

/**
 * <p>
 * 管理员后台指令设置
 * </p>
 *
 * @author MoFeng
 * @since 2024-04-16
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Schema(name = "Command对象", description = "管理员后台指令设置")
public class CommandVo extends BaseVo {
    @Schema(description= "管理员命令")
    private String commandValue;

    public CommandVo(Command command) {
        super(command);
        this.commandValue = command.getCommandValue();
    }

    public static List<CommandVo> change(Collection<Command> commandCollection) {
        if (commandCollection == null) {
            return null;
        }
        return commandCollection.stream().map(CommandVo::new).toList();
    }
}
